//
//  NaviBarSegmentedControl.m
//  Four_years
//
//  Created by 张跃骞 on 15/11/9.
//  Copyright © 2015年 中软三班四年小组. All rights reserved.
//

#import "NaviBarSegmentedControl.h"

@implementation NaviBarSegmentedControl

- (instancetype)initWithItems:(NSArray *)items addTarget:(id)target action:(SEL)action{
    
    if (self = [super initWithItems:items]) {
        
        self.selectedSegmentIndex = 0;
        
        for (int i = 0; i < items.count; i ++) {
            [self setWidth:Seg_Width forSegmentAtIndex:i];
        }
        
        self.tintColor = [UIColor clearColor];
        
        [self setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor colorWithWhite:1 alpha:.38], NSFontAttributeName:[UIFont systemFontOfSize:18 weight:0.025]} forState:UIControlStateNormal];
        
        
        [self setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor colorWithWhite:1 alpha:1], NSFontAttributeName:[UIFont systemFontOfSize:18 weight:0.025]} forState:UIControlStateSelected];
        
        [self addTarget:target action:action forControlEvents:UIControlEventValueChanged];
    }
    return self;
}

@end
